import type { IArticle } from '@/types'
import request from '@/utils/https'

export function getLesson(id: string) {
  return request<{ article: IArticle, comment: { id: string }, homeWork: number }>({
    url: `/art/info/${id}`,
    method: 'get'
  })
}

export function getKnowledge(id: string) {
  return request<{ article: IArticle, answer: { id: string } }>({
    url: `/artVideo/info/${id}`,
    method: 'get'
  })
}

export function saveAnswer(data: { articleId: string; answer: string; correct: string; }) {
  return request({
    url: '/saveInnoAnswer',
    method: 'post',
    data
  })
}

export function saveHomeScore(data: { groupId: number; duration: number; }) {
  return request({
    url: '/saveHomeScore',
    method: 'post',
    data
  })
}

export function saveMoveAnswer(data: any) {
  return request({
    url: '/saveMoveAnswer',
    method: 'post',
    data
  })
}

export const SPORT_OPTIONS = [
  { tiredKey: '安静，不费力', tiredLevel: '6', tiredHeart: '静息心率' },
  { tiredKey: '极其轻松', tiredLevel: '7-8', tiredHeart: '70' },
  { tiredKey: '很轻松', tiredLevel: '9', tiredHeart: '90' },
  { tiredKey: '轻松', tiredLevel: '10-11', tiredHeart: '90-110' },
  { tiredKey: '有点吃力', tiredLevel: '12-14', tiredHeart: '110-130' },
  { tiredKey: '吃力', tiredLevel: '15', tiredHeart: '150' },
  { tiredKey: '非常吃力', tiredLevel: '16-18', tiredHeart: '150-170' },
  { tiredKey: '极其吃力', tiredLevel: '19', tiredHeart: '195' },
  { tiredKey: '筋疲力竭', tiredLevel: '20', tiredHeart: '最大心率' }
]
